<?
function getmicrotime($elapsed=false){
    list($usec, $sec) = explode(" ", microtime());
    $tm = ((float)$usec + (float)$sec);
    if ($elapsed) return $tm-$GLOBALS['jl_time_start'];
    else return $tm;
}
define ('DEBUG',0); // 3-extended debug
define ('MSG_LEVEL',0);
define ('Jlib_USE_CACHE',0);
define ('Jlib_USE_PHP_REG',1);
define ('Jlib_USE_USER_REG',0);
//????????? ???
define ('accR',32);
define ('accW',16);
define ('accC',8);
define ('accD',4);
define ('accM',2);
define ('accI',1);


ini_set('zlib.output_compression', 'On');
ini_set('zlib.output_compression_level', '1');
//ini_set('default_charset','cp1251');
session_start();

require "lib/jlib.php";
require 'lib/system.php';
require 'lib/suppliers.php';
require 'lib/controls.php';
$jl_time_start=getmicrotime();

// use cache
if (Jlib_USE_CACHE && $_SERVER['REQUEST_METHOD']!='POST') {
	$cf='lib/cache/' . $_SERVER['QUERY_STRING'];
	if (file_exists($cf))
		echo file_get_contents($cf);
	else
		$GLOBALS['Jlib_need_cache']=$cf;
}

if (!Jlib_USE_CACHE || !empty($GLOBALS['Jlib_need_cache'])) {
	if(!empty($_GET['JsHttpRequest'])){
		require_once "lib/JsHttpRequest.php";
		$JsHttpRequest = new JsHttpRequest("windows-1251");
		$GLOBALS['result']=&$_RESULT;
		define('AJAX',true);
	}else define('AJAX',false);
	// ??????? ????
	$site=new site();
	// ??????? ??? ?????????
	while (!$site->load()) {
		while ($inc=inc()) {
			include_once($inc);
		}
	} ;

	// ??????? ??? ????????? ? ?????????? ?? ??????? ??????????????
	while (!$site->get_parsed()) {
		while ($inc=inc()) {
			include_once ($inc);
		}
	} ;

	// ?? ? ???????? ????? ?? ???:	
	$site->show();
	//$t=$GLOBALS['Jlib_frame']->obj['content1'];echo '<pre>'.print_r ( $t->params ,true).'</pre>';
}
//echo "<pre>",print_r( $GLOBALS['msgs_index'] ,true),"</pre>";
?>